package com.dev.module_ui_composable.utils

import android.content.Context
import android.widget.Toast

object ToastUtils {

    private var currentToast: Toast? = null

    fun showShortToast(context: Context, message: String) {
        cancelCurrentToast()
        currentToast = Toast.makeText(context, message, Toast.LENGTH_SHORT)
        currentToast?.show()
    }

    fun showLongToast(context: Context, message: String) {
        cancelCurrentToast()
        currentToast = Toast.makeText(context, message, Toast.LENGTH_LONG)
        currentToast?.show()
    }

    private fun cancelCurrentToast() {
        currentToast?.cancel()
    }
}